﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="EntradaProduto.aspx.cs" Inherits="SisVenda.Web.Restrito.EntradaProduto" %>

<%@ OutputCache Location="None" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="act" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server" autocomplete="off">
    <asp:Panel ID="aux" runat="server" Visible="true" HorizontalAlign="Right">
        <input type="checkbox" id="effect_fade" checked="checked" disabled="disabled" style="display: none" /><label
            for="effect_fade"></label>
        <input type="checkbox" id="effect_collapse" disabled="disabled" style="display: none" /><label
            for="effect_collapse"></label>
        <input type="checkbox" id="effect_color" disabled="disabled" style="display: none" /><label
            for="effect_color"></label>
    </asp:Panel>
    <asp:Panel ID="pnlCompra" runat="server" GroupingText="Compra">
        <asp:Panel ID="pnlColapse" runat="server" CssClass="collapsePanelHeader" Height="30px">
            <div style="padding: 5px; cursor: pointer; vertical-align: middle;">
                <div style="float: left;">
                    Compra</div>
                <div style="float: left; margin-left: 20px;">
                    <asp:Label ID="Label1" runat="server">[Expandir...]</asp:Label>
                </div>
                <div style="float: right; vertical-align: middle;">
                    <asp:ImageButton ID="Image1" runat="server" ImageUrl="~/App_Themes/Tema/Images/recolher.gif"
                        AlternateText="[Mostra Detalhes...]" />
                </div>
            </div>
        </asp:Panel>
        <asp:Panel ID="pnlListagem" runat="server">
            <fieldset>
                <legend>Pesquisa</legend>
                <table class="filtros">
                    <tr>
                        <td class="rotuloFiltro">
                            <asp:RadioButtonList ID="rblFornecedor" runat="server">
                                <asp:ListItem Value="Fornecedor" Selected="True">Fornecedor</asp:ListItem>
                                <asp:ListItem Value="NúmeroPedidoNotaFiscal">Número Pedido | Nota Fiscal</asp:ListItem>
                            </asp:RadioButtonList>
                        </td>
                        <td>
                            <asp:TextBox ID="tbxDescricao" runat="server" CssClass="largura450px"></asp:TextBox>
                            <act:FilteredTextBoxExtender ID="FilteredTextBoxExtenderDesc" runat="server" 
                                FilterType="Custom, LowercaseLetters, UppercaseLetters, Numbers" 
                                TargetControlID="tbxDescricao" ValidChars=" +*/-" />
                            <act:TextBoxWatermarkExtender ID="tbwtbxDescricao" runat="server" 
                                SkinID="Water440" TargetControlID="tbxDescricao" 
                                WatermarkText="Descrição Da Categoria Do Produto Para Pesquisa" />
                            <act:AutoCompleteExtender ID="autoComplete1" runat="server" 
                                BehaviorID="AutoCompleteEx" ServiceMethod="GetCompletionList" 
                                ServicePath="AutoCompleteFornecedor.asmx" SkinID="AutoComplete" 
                                TargetControlID="tbxDescricao">
                                <Animations>
                                <OnShow>
                                    <Sequence>
                                        <%-- Make the completion list transparent and then show it --%>
                                        <OpacityAction Opacity="0" />
                                        <HideAction Visible="true" />
                            
                                        <%--Cache the original size of the completion list the first time
                                            the animation is played and then set it to zero --%>
                                        <ScriptAction Script="
                                            // Cache the size and setup the initial size
                                            var behavior = $find('AutoCompleteEx');
                                            if (!behavior._height) {
                                            var target = behavior.get_completionList();
                                            behavior._height = target.offsetHeight - 2;
                                            target.style.height = '0px';}" />
                            
                                        <%-- Expand from 0px to the appropriate size while fading in --%>
                                        <Parallel Duration=".4">
                                            <FadeIn />
                                            <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx')._height" />
                                        </Parallel>
                                    </Sequence>
                                </OnShow>
                            <OnHide>
                                <%-- Collapse down to 0px and fade out --%>
                                <Parallel Duration=".4">
                                    <FadeOut />
                                    <Length PropertyKey="height" StartValueScript="$find('AutoCompleteEx')._height" EndValue="0" />
                                </Parallel>
                            </OnHide>
                                </Animations>
                            </act:AutoCompleteExtender>
                            <script type="text/javascript">
                                // Work around browser behavior of "auto-submitting" simple forms
                                var frm = document.getElementById("aspnetForm");
                                if (frm) {
                                    frm.onsubmit = function () { return false; };
                                }
                            </script>
                            <%-- Prevent enter in textbox from causing the collapsible panel from operating --%>
                            <input type="submit" style="display: none;" />
                        </td>
                        <td class="rotuloFiltro">
                            Linhas:
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlNumeroLinhasGrid" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlNumeroLinhasGrid_SelectedIndexChanged"
                                SkinID="Paginacao">
                            </asp:DropDownList>
                        </td>
                        <td align="right">
                            <asp:Button ID="btnPesquisar" runat="server" Text="Pesquisar" CausesValidation="False"
                                SkinID="Pesquisar" OnClick="btnPesquisar_Click" Style="height: 26px; margin-bottom: 0px;
                                cursor: pointer;" />
                        </td>
                    </tr>
                </table>
                <asp:UpdatePanel ID="upListagem" runat="server">
                    <ContentTemplate>
                        <asp:GridView ID="gvwListagem" runat="server" DataSourceID="odsGridViewCompra" AllowPaging="True"
                            OnDataBinding="gvwListagem_DataBinding" OnSelectedIndexChanged="gvwListagem_SelectedIndexChanged"
                            DataKeyNames="IdCompra" AutoGenerateColumns="False" SkinID="SemSelect" AllowSorting="True"
                            SelectedIndex="0" Style="margin-top: 0px">
                            <Columns>
                                <asp:TemplateField ShowHeader="False">
                                    <ItemStyle HorizontalAlign="Center" Width="25px" CssClass="PaddingGridView" />
                                    <HeaderStyle CssClass="PaddingGridViewHeader" />
                                    <ItemTemplate>
                                        <asp:ImageButton ID="ibnSelect" runat="server" CommandName="Select" CausesValidation="False"
                                            SkinID="Select" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="IdCompra" HeaderText="Código" />
                                <asp:BoundField DataField="Nome" HeaderText="Fornecedor" />
                                <asp:BoundField DataField="NumeroPedidoNotaFiscal" HeaderText="Número Pedido | Nota Fiscal" />
                                <asp:BoundField DataField="Valor" HeaderText="Valor R$" />
                                <asp:BoundField DataField="DataCompra" HeaderText="Data Compra" />
                            </Columns>
                        </asp:GridView>
                        <asp:ObjectDataSource ID="odsGridViewCompra" runat="server" OldValuesParameterFormatString="original_{0}"
                            SelectMethod="ObterCompra" TypeName="SisVenda.Web.Restrito.Fn.CompraFn" OnSelecting="odsGridViewCompra_Selecting">
                            <SelectParameters>
                                <asp:Parameter Name="tipoConsulta" Type="String" />
                                <asp:Parameter Name="parametroPesquisa" Type="String" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnPesquisar" EventName="Click" />
                        <asp:AsyncPostBackTrigger ControlID="ddlNumeroLinhasGrid" EventName="SelectedIndexChanged" />
                    </Triggers>
                </asp:UpdatePanel>
                <act:UpdatePanelAnimationExtender ID="upae" runat="server" 
                    BehaviorID="animation" TargetControlID="upListagem">
                    <Animations>
                <OnUpdating>
                    <Sequence>
                        <%-- Store the original height of the panel --%>
                        <ScriptAction Script="var b = $find('animation'); b._originalHeight = b._element.offsetHeight;" />
                        
                        <%-- Disable all the controls --%>
                        <Parallel duration="0">
                            <EnableAction AnimationTarget="effect_color" Enabled="false" />
                            <EnableAction AnimationTarget="effect_collapse" Enabled="false" />
                            <EnableAction AnimationTarget="effect_fade" Enabled="false" />
                        </Parallel>
                        <StyleAction Attribute="overflow" Value="hidden" />
                        
                        <%-- Do each of the selected effects --%>
                        <Parallel duration=".25" Fps="30">
                            <Condition ConditionScript="$get('effect_fade').checked">
                                <FadeOut AnimationTarget="up_container" minimumOpacity=".2" />
                            </Condition>
                            <Condition ConditionScript="$get('effect_collapse').checked">
                                <Resize Height="0" />
                            </Condition>
                            <Condition ConditionScript="$get('effect_color').checked">
                                <Color AnimationTarget="up_container" PropertyKey="backgroundColor"
                                    EndValue="#FFFFFF" StartValue="#FFFFFF" />
                            </Condition>
                        </Parallel>
                    </Sequence>
                </OnUpdating>
                <OnUpdated>
                    <Sequence>
                        <%-- Do each of the selected effects --%>
                        <Parallel duration=".25" Fps="30">
                            <Condition ConditionScript="$get('effect_fade').checked">
                                <FadeIn AnimationTarget="up_container" minimumOpacity=".2" />
                            </Condition>
                            <Condition ConditionScript="$get('effect_collapse').checked">
                                <%-- Get the stored height--%> 
                                <Resize HeightScript="$find('animation')._originalHeight" />                               
                            </Condition>
                           
                            <Condition ConditionScript="$get('effect_color').checked">
                                <Color AnimationTarget="up_container" PropertyKey="backgroundColor"
                                    StartValue="#FFFFFF" EndValue="#FFFFFF" />
                            </Condition>
                        </Parallel>
                        
                        <%-- Enable all the controls --%>
                        <Parallel duration="5">
                            <EnableAction AnimationTarget="effect_fade" Enabled="false" />
                            <EnableAction AnimationTarget="effect_collapse" Enabled="false" />
                            <EnableAction AnimationTarget="effect_color" Enabled="false" />
                        </Parallel>                            
                    </Sequence>
                </OnUpdated>
                    </Animations>
                </act:UpdatePanelAnimationExtender>
            </fieldset>
        </asp:Panel>
        <act:CollapsiblePanelExtender ID="cpeDemo" runat="Server" 
            CollapseControlID="pnlColapse" Collapsed="True" 
            CollapsedImage="../App_Themes/Tema/Images/expandir.gif" 
            CollapsedText="[Mostrar Detalhes...]" ExpandControlID="pnlColapse" 
            ExpandedImage="../App_Themes/Tema/Images/recolher.gif" 
            ExpandedText="[Ocultar Detalhes...]" ImageControlID="Image1" 
            SkinID="ColapsePanel" SuppressPostBack="true" TargetControlID="pnlListagem" 
            TextLabelID="Label1" />
        <asp:UpdatePanel ID="udpFvw" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:FormView ID="fvwCompra" runat="server" DataSourceID="odsFormViewCompra">
                    <EditItemTemplate>
                        <asp:Panel ID="pnlAlterar" runat="server" GroupingText="Alterar">
                            <div class="divTable">
                                <label>
                                Dados da Compra</label>
                                <hr />
                                <div class="divLinha">
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblCodigoCompraUpdate" runat="server" Text="Cód. Compra"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxCodigoUpdate" runat="server" CssClass="largura170px" 
                                                Enabled="false" ReadOnly="true" Text='<%# Eval("IdCompra") %>'></asp:TextBox>
                                        </div>
                                    </div>
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblCnpjFornecedorUpdate" runat="server" Text=" CNPJ Fornecedor"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxCnpjFornecedorUpdate" runat="server" AutoPostBack="True" 
                                                CssClass="largura170px" Enabled="false" Text='<%# Eval("CNPJ") %>'></asp:TextBox>
                                        </div>
                                    </div>
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 450px">
                                            <asp:Label ID="lblFornecedor" runat="server" Text="Razão Social"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxFornecedorUpdate" runat="server" CssClass="largura450px" 
                                                Enabled="false" Text='<%# Eval("Nome") %>'></asp:TextBox>
                                        </div>
                                    </div>
                                </div>
                                <div class="divLinha">
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblNumeroNotaPedidoUpdate" runat="server" 
                                                Text="Nº Nota Fiscal | Pedido"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxNumeroNotaPedidoUpdate" runat="server" 
                                                CssClass="largura170px" Text='<%# Eval("NumeroPedidonotaFiscal") %>'></asp:TextBox>
                                            <act:FilteredTextBoxExtender ID="ftbetbxNumeroNotaPedidoUpdate" runat="server" 
                                                FilterType="Numbers" TargetControlID="tbxNumeroNotaPedidoUpdate" 
                                                ValidChars="" />
                                            <asp:RequiredFieldValidator ID="rfvNumeroNotaPedidoUpdate" runat="server" 
                                                ControlToValidate="tbxNumeroNotaPedidoUpdate" Display="None" 
                                                ErrorMessage="O campo Numero Nota | PedidoUpdate deve ser informado." 
                                                ValidationGroup=""></asp:RequiredFieldValidator>
                                            <act:ValidatorCalloutExtender ID="rfvNumeroNotaPedidoUpdate_ValidatorCalloutExtender" 
                                                runat="server" CssClass="validar" Enabled="True" 
                                                TargetControlID="rfvNumeroNotaPedidoUpdate">
                                            </act:ValidatorCalloutExtender>
                                        </div>
                                    </div>
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblValorTotalCompraUpdate" runat="server" Text="Valor Total"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxValorTotalCompraUpdate" runat="server" 
                                                CssClass="largura170px" Enabled="false" ReadOnly="true" 
                                                Text='<%# Eval("Valor") %>'></asp:TextBox>
                                        </div>
                                    </div>
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblDataUpdate" runat="server" Text="Data"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxDataUpdate" runat="server" required="" SkinID="Data" 
                                                Text='<%# Eval("DataCompra") %>'></asp:TextBox>
                                            <act:CalendarExtender ID="tbxDataUpdate_CalendarExtender" runat="server" 
                                                Animated="False" ClearTime="True" CssClass="cal_Theme1" Enabled="True" 
                                                Format="dd/MM/yyyy" PopupPosition="BottomRight" TargetControlID="tbxDataUpdate">
                                            </act:CalendarExtender>
                                            <act:MaskedEditExtender ID="tbxDataUpdate_MaskedEditExtender" runat="server" 
                                                ClearMaskOnLostFocus="True" CultureAMPMPlaceholder="" 
                                                CultureCurrencySymbolPlaceholder="" CultureDateFormat="" 
                                                CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                                                CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" 
                                                ErrorTooltipEnabled="True" Filtered="" InputDirection="RightToLeft" 
                                                Mask="99/99/9999" MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus" 
                                                OnInvalidCssClass="MaskedEditError" PromptCharacter="_" SkinID="Data" 
                                                TargetControlID="tbxDataUpdate">
                                            </act:MaskedEditExtender>
                                            <asp:RequiredFieldValidator ID="rfvDataUpdate" runat="server" 
                                                ControlToValidate="tbxDataUpdate" Display="None" 
                                                ErrorMessage="O campo Data deve ser informado." ValidationGroup=""></asp:RequiredFieldValidator>
                                            <act:ValidatorCalloutExtender ID="rfvDataUpdate_ValidatorCalloutExtender" 
                                                runat="server" CssClass="validar" Enabled="True" 
                                                TargetControlID="rfvDataUpdate">
                                            </act:ValidatorCalloutExtender>
                                        </div>
                                    </div>
                                </div>
                                <div class="acoes">
                                    <asp:Button ID="btnSalvarCompraUpdate" runat="server" CausesValidation="False" 
                                        OnClick="btnSalvarCompraUpdate_Click" SkinID="Salvar" Style="cursor: pointer;" 
                                        Text="Salvar" />
                                    <asp:Button ID="btnLimparCompraUpdate" runat="server" CausesValidation="False" 
                                        OnClick="btnLimparCompraUpdate_Click" Style="cursor: pointer;" Text="Limpar" />
                                </div>
                                <asp:Panel ID="pnlItemCompraAlterar" runat="server" 
                                    GroupingText="Alterar Item Compra" Visible="True">
                                    <div class="divLinha">
                                        <div class="divCell">
                                            <div class="divConteudo" style="width: 180px">
                                                <asp:Label ID="lblCodigoProdutoUpdate" runat="server" Text="Cod. Produto"></asp:Label>
                                                <br />
                                                <asp:TextBox ID="tbxCodigoProdutoUpdate" runat="server" 
                                                    AutoCompleteType="Disabled" AutoPostBack="true" CssClass="largura170px" 
                                                    MaxLength="10" ontextchanged="tbxCodigoProdutoUpdate_TextChanged"></asp:TextBox>
                                                <act:FilteredTextBoxExtender ID="ftbetbxCodigoProdutoUpdate" runat="server" 
                                                    FilterType="Numbers" TargetControlID="tbxCodigoProdutoUpdate" ValidChars="" />
                                                <asp:RequiredFieldValidator ID="rfvCodigoProdutoUpdate" runat="server" 
                                                    ControlToValidate="tbxCodigoProdutoUpdate" Display="None" 
                                                    ErrorMessage="O campo CodigoProduto deve ser informado." 
                                                    ValidationGroup="compraUpdate"></asp:RequiredFieldValidator>
                                                <act:ValidatorCalloutExtender ID="rfvCodigoProdutoUpdate_ValidatorCalloutExtender" 
                                                    runat="server" CssClass="validar" Enabled="True" 
                                                    TargetControlID="rfvCodigoProdutoUpdate">
                                                </act:ValidatorCalloutExtender>
                                            </div>
                                        </div>
                                        <div class="divCell">
                                            <div class="divConteudo" style="width: 450px">
                                                <asp:Label ID="lblProdutoUpdate" runat="server" Text="Produto"></asp:Label>
                                                <br />
                                                <asp:TextBox ID="tbxDescricaoProdutoUpdate" runat="server" 
                                                    CssClass="largura450px" Enabled="False"></asp:TextBox>
                                            </div>
                                        </div>
                                        <div class="divCell">
                                            <div class="divConteudo" style="width: 160px">
                                                <asp:Label ID="lblUnidadeUpdate" runat="server" Text="Unidade"></asp:Label>
                                                <br />
                                                <asp:TextBox ID="tbxUnidadeUpdate" runat="server" CssClass="largura150px" 
                                                    Enabled="False"></asp:TextBox>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="divLinha">
                                        <div class="divCell">
                                            <div class="divConteudo" style="width: 180px">
                                                <asp:Label ID="lblQuantidade" runat="server" Text="Quantidade"></asp:Label>
                                                <br />
                                                <asp:TextBox ID="tbxQuantidadeUpdate" runat="server" 
                                                    AutoCompleteType="Disabled" AutoPostBack="True" CssClass="largura170px" 
                                                    MaxLength="10" OnTextChanged="tbxQuantidadeUpdate_TextChanged"></asp:TextBox>
                                                <act:FilteredTextBoxExtender ID="ftbetbxQuantidadeUpdate" runat="server" 
                                                    FilterType="Numbers" TargetControlID="tbxQuantidadeUpdate" ValidChars="" />
                                                <asp:RequiredFieldValidator ID="rfvQuantidadeUpdate" runat="server" 
                                                    ControlToValidate="tbxQuantidadeUpdate" Display="None" 
                                                    ErrorMessage="O campo Quantidade deve ser informado." 
                                                    ValidationGroup="compraUpdate"></asp:RequiredFieldValidator>
                                                <act:ValidatorCalloutExtender ID="rfvQuantidadeUpdate_ValidatorCalloutExtender" 
                                                    runat="server" CssClass="validar" Enabled="True" 
                                                    TargetControlID="rfvQuantidadeUpdate">
                                                </act:ValidatorCalloutExtender>
                                            </div>
                                        </div>
                                        <div class="divCell">
                                            <div class="divConteudo" style="width: 180px">
                                                <asp:Label ID="lblPrecoUpdate" runat="server" Text="Preço"></asp:Label>
                                                <br />
                                                <asp:TextBox ID="tbxPrecoUpdate" runat="server" AutoCompleteType="Disabled" 
                                                    AutoPostBack="True" CssClass="largura170px" 
                                                    OnTextChanged="tbxPrecoUpdate_TextChanged"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="rfvPrecoUpdate" runat="server" 
                                                    ControlToValidate="tbxPrecoUpdate" Display="None" 
                                                    ErrorMessage="O campo Preco deve ser informado." ValidationGroup="compraUpdate"></asp:RequiredFieldValidator>
                                                <act:ValidatorCalloutExtender ID="rfvPrecoUpdate_ValidatorCalloutExtender" 
                                                    runat="server" CssClass="validar" Enabled="True" 
                                                    TargetControlID="rfvPrecoUpdate">
                                                </act:ValidatorCalloutExtender>
                                                <act:MaskedEditExtender ID="tbxPrecoUpdate_MaskedEditExtender" runat="server" 
                                                    ClearMaskOnLostFocus="True" CultureAMPMPlaceholder="" 
                                                    CultureCurrencySymbolPlaceholder="" CultureDateFormat="" 
                                                    CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                                                    CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" 
                                                    ErrorTooltipEnabled="True" Filtered="" InputDirection="RightToLeft" 
                                                    Mask="NNNNNNNNN.NN" MaskType="Number" MessageValidatorTip="true" 
                                                    OnFocusCssClass="MaskedEditFocus" OnInvalidCssClass="MaskedEditError" 
                                                    PromptCharacter="_" TargetControlID="tbxPrecoUpdate">
                                                </act:MaskedEditExtender>
                                            </div>
                                        </div>
                                        <div class="divCell">
                                            <div class="divConteudo" style="width: 180px">
                                                <asp:Label ID="lblValorTotalUpdate" runat="server" Text="V. Total"></asp:Label>
                                                <br />
                                                <asp:TextBox ID="tbxValorTotalUpdate" runat="server" CssClass="largura170px" 
                                                    Enabled="false" ReadOnly="true"></asp:TextBox>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="acoes">
                                        <asp:Button ID="btnInserirItemUpdate" runat="server" CausesValidation="False" 
                                            onclick="btnInserirItemUpdate_Click" SkinID="Inserir" Style="cursor: pointer;" 
                                            Text="Inserir" />
                                        <asp:Button ID="btnSalvarItemUpdate" runat="server" CausesValidation="False" 
                                            OnClick="btnSalvarItemUpdate_Click" SkinID="Salvar" Style="cursor: pointer;" 
                                            Text="Salvar" Visible="False" />
                                        <asp:Button ID="btnLimparItemUpdate" runat="server" CausesValidation="False" 
                                            OnClick="btnLimparItemUpdate_Click" Style="cursor: pointer;" Text="Limpar" />
                                    </div>
                                    <br />
                                    <asp:GridView ID="gvwItemCompraUpdate" runat="server" AllowPaging="True" 
                                        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="IdProduto" 
                                        DataSourceID="odsItemCompraUpdate" 
                                        OnRowCommand="gvwItemCompraUpdate_RowCommand" SkinID="SemSelect">
                                        <Columns>
                                            <asp:TemplateField ShowHeader="False">
                                                <ItemStyle CssClass="PaddingGridView" HorizontalAlign="Center" Width="25px" />
                                                <HeaderStyle CssClass="PaddingGridViewHeader" />
                                                <ItemTemplate>
                                                    <asp:ImageButton ID="ibnSelect" runat="server" CausesValidation="False" 
                                                        CommandArgument='<%# Bind("IdProduto") %>' CommandName="Select" 
                                                        SkinID="Select" />
                                                    <asp:ImageButton ID="ibnExcluir" runat="server" 
                                                        CommandArgument='<%# Bind("IdProduto") %>' CommandName="Excluir" 
                                                        SkinID="AcaoExcluir" />
                                                    <act:ConfirmButtonExtender ID="ibnExcluir_ConfirmButtonExtender" runat="server" 
                                                        Enabled="True" SkinID="Excluir" TargetControlID="ibnExcluir">
                                                    </act:ConfirmButtonExtender>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="IdProduto" HeaderText="Código" />
                                            <asp:BoundField DataField="Descricao" HeaderText="Descrição Produto" />
                                            <asp:BoundField DataField="Unidade" HeaderText="Un." />
                                            <asp:BoundField DataField="Quantidade" HeaderText="Quant." />
                                            <asp:BoundField DataField="Preco" HeaderText="V. Unitário" />
                                            <asp:BoundField DataField="Valor" HeaderText="Valor" />
                                        </Columns>
                                    </asp:GridView>
                                    <asp:ObjectDataSource ID="odsItemCompraUpdate" runat="server" 
                                        DeleteMethod="DeleteItemCompra" OldValuesParameterFormatString="original_{0}" 
                                        SelectMethod="ObterItensCompra" TypeName="SisVenda.Web.Restrito.Fn.CompraFn">
                                        <DeleteParameters>
                                            <asp:Parameter Name="idCompra" Type="Int32" />
                                            <asp:Parameter Name="idProduto" Type="Int32" />
                                        </DeleteParameters>
                                        <SelectParameters>
                                            <asp:ControlParameter ControlID="tbxCodigoUpdate" Name="idCompra" 
                                                PropertyName="Text" Type="Int32" />
                                        </SelectParameters>
                                    </asp:ObjectDataSource>
                                </asp:Panel>
                                <div class="acoes">
                                    <asp:Button ID="btnFinalizarUpdate" runat="server" CommandName="Cancel" 
                                        Text="Finalizar" />
                                    <br />
                                    <act:ConfirmButtonExtender ID="ConfirmButtonExtenderUpdate" runat="server" 
                                        DisplayModalPopupID="ModalPopupExtenderUpdate" OnClientCancel="cancelClick" 
                                        TargetControlID="btnFinalizarUpdate" />
                                    <br />
                                    <act:ModalPopupExtender ID="ModalPopupExtenderUpdate" runat="server" 
                                        BackgroundCssClass="modalBackground" CancelControlID="ButtonCancelUpdate" 
                                        OkControlID="ButtonOkUpdate" PopupControlID="PNLUpdate" 
                                        TargetControlID="btnFinalizarUpdate" />
                                    <asp:Panel ID="PNLUpdate" runat="server" Style="display: none; width: 200px; background-color: White;
                                        border-width: 2px; border-color: Black; border-style: solid; padding: 20px; text-align: left;
                                        background: -webkit-gradient(linear, left top, left 560, from(#bfcbd6), color-stop(4%, #bfcbd6), to(#FFFFFF));
                                        background: -moz-linear-gradient(top, #bfcbd6, #bfcbd6 1px, #FFFFFF 50px); border-radius: 4px;
                                        -webkit-border-radius: 4px; -moz-border-radius: 4px">
                                        <div style="text-align: right;">
                                            <img alt="?" src="../App_Themes/Tema/Images/help-icon.png" />
                                        </div>
                                        Os valores informados até o momento foram salvos.<br /> Confirma a finalização 
                                        da operação?
                                        <br />
                                        <div style="text-align: right;">
                                            <asp:Button ID="ButtonOkUpdate" runat="server" Style="cursor: pointer;" 
                                                Text="Sim" />
                                            <asp:Button ID="ButtonCancelUpdate" runat="server" Style="cursor: pointer;" 
                                                Text="Não" />
                                        </div>
                                    </asp:Panel>
                                </div>
                            </div>
                        </asp:Panel>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:Panel ID="pnlNovo" runat="server" GroupingText="Nova Compra">
                            <div class="divTable">
                                <label>
                                Dados da Compra</label>
                                <hr />
                                <div class="divLinha">
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblCodigoCompraInsert" runat="server" Text="Cód. Compra"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxCodigoInsert" runat="server" CssClass="largura170px" 
                                                Enabled="false" ReadOnly="true"></asp:TextBox>
                                        </div>
                                    </div>
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblCnpjFornecedorInsert" runat="server" Text=" CNPJ Fornecedor"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxCnpjFornecedorInsert" runat="server" AutoPostBack="True" 
                                                ControlToValidate="tbxCnpjFornecedorInsert" CssClass="largura170px" 
                                                OnTextChanged="tbxCnpjFornecedorInsertEvent"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="rfvCnpjFornecedorInsert" runat="server" 
                                                ControlToValidate="tbxCnpjFornecedorInsert" Display="None" 
                                                ErrorMessage="O campo CNPJ deve ser informado." ValidationGroup="compraInsert"></asp:RequiredFieldValidator>
                                            <act:ValidatorCalloutExtender ID="rfvCnpjFornecedorInsert_ValidatorCalloutExtender" 
                                                runat="server" CssClass="validar" Enabled="True" 
                                                TargetControlID="rfvCnpjFornecedorInsert">
                                            </act:ValidatorCalloutExtender>
                                            <act:MaskedEditExtender ID="tbxCnpjFornecedorInsertt_MaskedEditExtender" 
                                                runat="server" ClearMaskOnLostFocus="True" CultureAMPMPlaceholder="" 
                                                CultureCurrencySymbolPlaceholder="" CultureDateFormat="" 
                                                CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                                                CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" 
                                                ErrorTooltipEnabled="True" Filtered="" InputDirection="RightToLeft" 
                                                Mask="99\.999\.999/9999\-99" MessageValidatorTip="true" 
                                                OnFocusCssClass="MaskedEditFocus" OnInvalidCssClass="MaskedEditError" 
                                                PromptCharacter="_" SkinID="Cnpj" TargetControlID="tbxCnpjFornecedorInsert">
                                            </act:MaskedEditExtender>
                                        </div>
                                    </div>
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 450px">
                                            <asp:Label ID="lblFornecedor" runat="server" Text="Razão Social"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxFornecedorInsert" runat="server" CssClass="largura450px" 
                                                Enabled="false"></asp:TextBox>
                                        </div>
                                    </div>
                                </div>
                                <div class="divLinha">
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblNumeroNotaPedidoInsert" runat="server" 
                                                Text="Nº Nota Fiscal|Pedido"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxNumeroNotaPedidoInsert" runat="server" 
                                                CssClass="largura170px"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="rfvNumeroNotaPedidoInsert" runat="server" 
                                                ControlToValidate="tbxNumeroNotaPedidoInsert" Display="None" 
                                                ErrorMessage="RequiredFieldValidator" ValidationGroup="compraInsert">
                                            </asp:RequiredFieldValidator>
                                            <act:ValidatorCalloutExtender ID="rfvNumeroNotaPedidoInsert_ValidatorCalloutExtender" 
                                                runat="server" CssClass="validar" Enabled="True" 
                                                TargetControlID="rfvNumeroNotaPedidoInsert">
                                            </act:ValidatorCalloutExtender>
                                            <act:FilteredTextBoxExtender ID="ftbetbxNumeroNotaPedidoInsert" runat="server" 
                                                FilterType="Numbers" TargetControlID="tbxNumeroNotaPedidoInsert" 
                                                ValidChars="" />
                                        </div>
                                    </div>
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblValorTotalCompraInsert" runat="server" Text="Valor Total"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxValorTotalCompraInsert" runat="server" 
                                                CssClass="largura170px" Enabled="false" ReadOnly="true" Text="0.00"></asp:TextBox>
                                        </div>
                                    </div>
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblDataInsert" runat="server" Text="Data"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxDataInsert" runat="server" SkinID="Data"></asp:TextBox>
                                            <act:CalendarExtender ID="tbxDataInsert_CalendarExtender" runat="server" 
                                                Animated="False" ClearTime="True" CssClass="cal_Theme1" Enabled="True" 
                                                Format="dd/MM/yyyy" PopupPosition="BottomRight" TargetControlID="tbxDataInsert">
                                            </act:CalendarExtender>
                                            <act:MaskedEditExtender ID="tbxDataInsert_MaskedEditExtender" runat="server" 
                                                ClearMaskOnLostFocus="True" CultureAMPMPlaceholder="" 
                                                CultureCurrencySymbolPlaceholder="" CultureDateFormat="" 
                                                CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                                                CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" 
                                                ErrorTooltipEnabled="True" Filtered="" InputDirection="RightToLeft" 
                                                Mask="99/99/9999" MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus" 
                                                OnInvalidCssClass="MaskedEditError" PromptCharacter="_" SkinID="Data" 
                                                TargetControlID="tbxDataInsert">
                                            </act:MaskedEditExtender>
                                            <asp:RequiredFieldValidator ID="rfvDataInsert" runat="server" 
                                                ControlToValidate="tbxDataInsert" Display="None" 
                                                ErrorMessage="O campo Data deve ser informado." ValidationGroup="compraInsert"></asp:RequiredFieldValidator>
                                            <act:ValidatorCalloutExtender ID="rfvDataInsert_ValidatorCalloutExtender" 
                                                runat="server" CssClass="validar" Enabled="True" 
                                                TargetControlID="rfvDataInsert">
                                            </act:ValidatorCalloutExtender>
                                        </div>
                                    </div>
                                </div>
                                <div class="acoes">
                                    <asp:Button ID="btnInserirCompraInsert" runat="server" CausesValidation="False" 
                                        OnClick="btnInserirCompraInsert_Click" SkinID="Inserir" 
                                        Style="cursor: pointer;" Text="Inserir" ValidationGroup="compraInsert" />
                                    &nbsp;&nbsp;
                                    <asp:Button ID="btnCancelarCompraInsert" runat="server" 
                                        CausesValidation="False" CommandName="Cancel" SkinID="Cancelar" 
                                        Style="cursor: pointer;" Text="Cancelar" />
                                    <act:ConfirmButtonExtender ID="ConfirmButtonExtenderCompraInsert" 
                                        runat="server" DisplayModalPopupID="ModalPopupExtenderCompra" 
                                        OnClientCancel="cancelClick" TargetControlID="btnCancelarCompraInsert" />
                                    <br />
                                    <act:ModalPopupExtender ID="ModalPopupExtenderCompra" runat="server" 
                                        BackgroundCssClass="modalBackground" CancelControlID="ButtonCancelCompraInsert" 
                                        OkControlID="ButtonOkCompraInsert" PopupControlID="PNLCompraInsert" 
                                        TargetControlID="btnCancelarCompraInsert" />
                                    <asp:Panel ID="PNLCompraInsert" runat="server" Style="display: none; width: 200px;
                                        background-color: White; border-width: 2px; border-color: Black; border-style: solid;
                                        padding: 20px; text-align: left; background: -webkit-gradient(linear, left top, left 560, from(#bfcbd6), color-stop(4%, #bfcbd6), to(#FFFFFF));
                                        background: -moz-linear-gradient(top, #bfcbd6, #bfcbd6 1px, #FFFFFF 50px); border-radius: 4px;
                                        -webkit-border-radius: 4px; -moz-border-radius: 4px">
                                        <div style="text-align: right;">
                                            <img alt="?" src="../App_Themes/Tema/Images/help-icon.png" />
                                        </div>
                                        Os valores informados serão descartados e o registro não será inserido.
                                        <br />
                                        Confirma o cancelamento da operação?
                                        <br />
                                        <br />
                                        <div style="text-align: right;">
                                            <asp:Button ID="ButtonOkCompraInsert" runat="server" Style="cursor: pointer;" 
                                                Text="Sim" />
                                            <asp:Button ID="ButtonCancelCompraInsert" runat="server" 
                                                Style="cursor: pointer;" Text="Não" />
                                        </div>
                                    </asp:Panel>
                                </div>
                                <asp:Panel ID="pnlItemCompra" runat="server" GroupingText="Incluir Item Compra" 
                                    Visible="False">
                                    <div class="divLinha">
                                        <div class="divCell">
                                            <div class="divConteudo" style="width: 180px">
                                                <asp:Label ID="lblCodigoProdutoInsert" runat="server" Text="Cod. Produto"></asp:Label>
                                                <br />
                                                <asp:TextBox ID="tbxCodigoProdutoInsert" runat="server" 
                                                    AutoCompleteType="Disabled" AutoPostBack="true" CssClass="largura170px" 
                                                    OnTextChanged="tbxCodigoProdutoInsert_TextChanged"></asp:TextBox>
                                                <act:FilteredTextBoxExtender ID="ftbetbxCodigoProdutoInsert" runat="server" 
                                                    FilterType="Numbers" TargetControlID="tbxCodigoProdutoInsert" ValidChars="" />
                                                <asp:RequiredFieldValidator ID="rfvCodigoProdutoInsert" runat="server" 
                                                    ControlToValidate="tbxCodigoProdutoInsert" Display="None" 
                                                    ErrorMessage="O campo Código deve ser informado." ValidationGroup="itemInsert"></asp:RequiredFieldValidator>
                                                <act:ValidatorCalloutExtender ID="rfvCodigoProdutoInsert_ValidatorCalloutExtender" 
                                                    runat="server" CssClass="validar" Enabled="True" 
                                                    TargetControlID="rfvCodigoProdutoInsert">
                                                </act:ValidatorCalloutExtender>
                                            </div>
                                        </div>
                                        <div class="divCell">
                                            <div class="divConteudo" style="width: 450px">
                                                <asp:Label ID="lblProdutoInsert" runat="server" Text="Produto"></asp:Label>
                                                <br />
                                                <asp:TextBox ID="tbxDescricaoProdutoInsert" runat="server" 
                                                    CssClass="largura450px" Enabled="False"></asp:TextBox>
                                            </div>
                                        </div>
                                        <div class="divCell">
                                            <div class="divConteudo" style="width: 160px">
                                                <asp:Label ID="lblUnidadeInsert" runat="server" Text="Un."></asp:Label>
                                                <br />
                                                <asp:TextBox ID="tbxUnidadeInsert" runat="server" CssClass="largura150px" 
                                                    Enabled="False"></asp:TextBox>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="divLinha">
                                        <div class="divCell">
                                            <div class="divConteudo" style="width: 180px">
                                                <asp:Label ID="lblQuantidade" runat="server" Text="Quantidade"></asp:Label>
                                                <br />
                                                <asp:TextBox ID="tbxQuantidadeInsert" runat="server" 
                                                    AutoCompleteType="Disabled" AutoPostBack="True" CssClass="largura170px" 
                                                    OnTextChanged="tbxQuantidadeInsert_TextChanged"></asp:TextBox>
                                                <act:FilteredTextBoxExtender ID="ftbetbxQuantidadeInsert" runat="server" 
                                                    FilterType="Numbers" TargetControlID="tbxQuantidadeInsert" ValidChars="" />
                                                <asp:RequiredFieldValidator ID="rfvQuantidadeInsert" runat="server" 
                                                    ControlToValidate="tbxQuantidadeInsert" Display="None" 
                                                    ErrorMessage="O campo Quantidade deve ser informado." 
                                                    ValidationGroup="itemInsert"></asp:RequiredFieldValidator>
                                                <act:ValidatorCalloutExtender ID="rfvSalarioUp_ValidatorCalloutExtender" 
                                                    runat="server" CssClass="validar" Enabled="True" 
                                                    TargetControlID="rfvQuantidadeInsert">
                                                </act:ValidatorCalloutExtender>
                                            </div>
                                        </div>
                                        <div class="divCell">
                                            <div class="divConteudo" style="width: 180px">
                                                <asp:Label ID="lblPrecoInsert" runat="server" Text="Preço"></asp:Label>
                                                <br />
                                                <asp:TextBox ID="tbxPrecoInsert" runat="server" AutoCompleteType="Disabled" 
                                                    AutoPostBack="True" CssClass="largura170px" 
                                                    OnTextChanged="tbxPrecoInsert_TextChanged"></asp:TextBox>
                                                <act:MaskedEditExtender ID="tbxPrecoInsert_MaskedEditExtender" runat="server" 
                                                    ClearMaskOnLostFocus="True" CultureAMPMPlaceholder="" 
                                                    CultureCurrencySymbolPlaceholder="" CultureDateFormat="" 
                                                    CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                                                    CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" 
                                                    ErrorTooltipEnabled="True" Filtered="" InputDirection="RightToLeft" 
                                                    Mask="NNNNNNNNN.NN" MaskType="Number" MessageValidatorTip="true" 
                                                    OnFocusCssClass="MaskedEditFocus" OnInvalidCssClass="MaskedEditError" 
                                                    PromptCharacter="_" TargetControlID="tbxPrecoInsert">
                                                </act:MaskedEditExtender>
                                                <asp:RequiredFieldValidator ID="rfvPrecoInsert" runat="server" 
                                                    ControlToValidate="tbxPrecoInsert" Display="None" 
                                                    ErrorMessage="O campo Salário deve ser informado." ValidationGroup="itemInsert"></asp:RequiredFieldValidator>
                                                <act:ValidatorCalloutExtender ID="rfvPrecoInsert_ValidatorCalloutExtender" 
                                                    runat="server" CssClass="validar" Enabled="True" 
                                                    TargetControlID="rfvPrecoInsert">
                                                </act:ValidatorCalloutExtender>
                                            </div>
                                        </div>
                                        <div class="divCell">
                                            <div class="divConteudo" style="width: 180px">
                                                <asp:Label ID="lblValorTotalInsert" runat="server" Text="V. Total"></asp:Label>
                                                <br />
                                                <asp:TextBox ID="tbxValorTotalInsert" runat="server" CssClass="largura170px" 
                                                    Enabled="false" ReadOnly="true"></asp:TextBox>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="acoes">
                                        <asp:Button ID="btnIncluirItemInsert" runat="server" CausesValidation="False" 
                                            OnClick="btnIncluirItemInsert_Click" SkinID="Inserir" Style="cursor: pointer;" 
                                            Text="Incluir" />
                                        <asp:Button ID="btnLimparItemInsert" runat="server" CausesValidation="False" 
                                            OnClick="btnLimparItemInsert_Click" Style="cursor: pointer;" Text="Limpar" />
                                    </div>
                                    <br />
                                    <asp:GridView ID="gvwItemCompraInsert" runat="server" AllowPaging="True" 
                                        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="IdProduto" 
                                        DataSourceID="odsItemCompraInsert" 
                                        OnRowCommand="gvwItemCompraInsert_RowCommand" SkinID="SemSelect">
                                        <Columns>
                                            <asp:TemplateField ShowHeader="False">
                                                <ItemStyle CssClass="PaddingGridView" HorizontalAlign="Center" Width="25px" />
                                                <HeaderStyle CssClass="PaddingGridViewHeader" />
                                                <ItemTemplate>
                                                    <asp:ImageButton ID="ibnExcluir" runat="server" 
                                                        CommandArgument='<%# Bind("IdProduto") %>' CommandName="Excluir" 
                                                        SkinID="AcaoExcluir" />
                                                    <act:ConfirmButtonExtender ID="ibnExcluir_ConfirmButtonExtender" runat="server" 
                                                        Enabled="True" SkinID="Excluir" TargetControlID="ibnExcluir">
                                                    </act:ConfirmButtonExtender>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="IdProduto" HeaderText="Código" />
                                            <asp:BoundField DataField="Descricao" HeaderText="Descrição Produto" />
                                            <asp:BoundField DataField="Unidade" HeaderText="Un." />
                                            <asp:BoundField DataField="Quantidade" HeaderText="Quant." />
                                            <asp:BoundField DataField="Preco" HeaderText="V. Unitário" />
                                            <asp:BoundField DataField="Valor" HeaderText="Valor" />
                                        </Columns>
                                    </asp:GridView>
                                    <asp:ObjectDataSource ID="odsItemCompraInsert" runat="server" 
                                        DeleteMethod="DeleteItemCompra" OldValuesParameterFormatString="original_{0}" 
                                        SelectMethod="ObterItensCompra" TypeName="SisVenda.Web.Restrito.Fn.CompraFn">
                                        <DeleteParameters>
                                            <asp:Parameter Name="idCompra" Type="Int32" />
                                            <asp:Parameter Name="idProduto" Type="Int32" />
                                        </DeleteParameters>
                                        <SelectParameters>
                                            <asp:ControlParameter ControlID="tbxCodigoInsert" Name="idCompra" 
                                                PropertyName="Text" Type="Int32" />
                                        </SelectParameters>
                                    </asp:ObjectDataSource>
                                </asp:Panel>
                                <div class="acoes">
                                    <asp:Button ID="btnFinalizarInsert" runat="server" CommandName="Cancel" 
                                        Text="Finalizar" Visible="false" />
                                    <br />
                                    <act:ConfirmButtonExtender ID="ConfirmButtonExtenderInsert" runat="server" 
                                        DisplayModalPopupID="ModalPopupExtenderInsert" OnClientCancel="cancelClick" 
                                        TargetControlID="btnFinalizarInsert" />
                                    <br />
                                    <act:ModalPopupExtender ID="ModalPopupExtenderInsert" runat="server" 
                                        BackgroundCssClass="modalBackground" CancelControlID="ButtonCancelInsert" 
                                        OkControlID="ButtonOkInsert" PopupControlID="PNLInsert" 
                                        TargetControlID="btnFinalizarInsert" />
                                    <asp:Panel ID="PNLInsert" runat="server" Style="display: none; width: 200px; background-color: White;
                                        border-width: 2px; border-color: Black; border-style: solid; padding: 20px; text-align: left;
                                        background: -webkit-gradient(linear, left top, left 560, from(#bfcbd6), color-stop(4%, #bfcbd6), to(#FFFFFF));
                                        background: -moz-linear-gradient(top, #bfcbd6, #bfcbd6 1px, #FFFFFF 50px); border-radius: 4px;
                                        -webkit-border-radius: 4px; -moz-border-radius: 4px">
                                        <div style="text-align: right;">
                                            <img alt="?" src="../App_Themes/Tema/Images/help-icon.png" />
                                        </div>
                                        Os valores informados até o momento foram salvos.<br /> Confirma a finalização 
                                        da operação?
                                        <br />
                                        <div style="text-align: right;">
                                            <asp:Button ID="ButtonOkInsert" runat="server" Style="cursor: pointer;" 
                                                Text="Sim" />
                                            <asp:Button ID="ButtonCancelInsert" runat="server" Style="cursor: pointer;" 
                                                Text="Não" />
                                        </div>
                                    </asp:Panel>
                                </div>
                            </div>
                        </asp:Panel>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Panel ID="pnEdicao" runat="server" GroupingText="Edição">
                            <div class="divTable">
                                <label>
                                Dados da Compra</label>
                                <hr />
                                <div class="divLinha">
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblCodigoCompraItem" runat="server" Text="Cód. Compra"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxCodigoItem" runat="server" CssClass="largura170px" 
                                                Enabled="false" ReadOnly="true" Text='<%# Eval("IdCompra") %>'></asp:TextBox>
                                        </div>
                                    </div>
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblCnpjFornecedorItem" runat="server" Text=" CNPJ Fornecedor"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxCnpjFornecedorItem" runat="server" CssClass="largura170px" 
                                                Enabled="false" Text='<%# Eval("CNPJ") %>'></asp:TextBox>
                                        </div>
                                    </div>
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 450px">
                                            <asp:Label ID="lblFornecedorItem" runat="server" Text=" Fornecedor"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxFornecedorItem" runat="server" CssClass="largura450px" 
                                                Enabled="false" Text='<%# Eval("Nome") %>'></asp:TextBox>
                                        </div>
                                    </div>
                                </div>
                                <div class="divLinha">
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblNumeroPedidoNotaFiscalItem" runat="server" 
                                                Text="Nº Nota F.|Pedido"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxNumeroNotaPedidoItem" runat="server" 
                                                CssClass="largura170px" Enabled="false" 
                                                Text='<%# Eval("NumeroPedidonotaFiscal") %>'></asp:TextBox>
                                        </div>
                                    </div>
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblValorTotalCompraItem" runat="server" Text="V. Total"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxValorTotalCompraItem" runat="server" 
                                                CssClass="largura170px" Enabled="false" ReadOnly="true" 
                                                Text='<%# Eval("Valor") %>'></asp:TextBox>
                                        </div>
                                    </div>
                                    <div class="divCell">
                                        <div class="divConteudo" style="width: 180px">
                                            <asp:Label ID="lblDataItem" runat="server" Text="Data"></asp:Label>
                                            <br />
                                            <asp:TextBox ID="tbxDataItem" runat="server" CssClass="largura170px" 
                                                Enabled="false" Text='<%# Eval("DataCompra") %>'></asp:TextBox>
                                        </div>
                                    </div>
                                </div>
                                <div class="divLinha">
                                    <asp:Panel ID="pnlItemCompraNovo" runat="server" GroupingText="Itens da Compra">
                                        <asp:GridView ID="gvwItemCompra" runat="server" AllowPaging="True" 
                                            AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="idProduto" 
                                            DataSourceID="odsItemCompraItem" OnDataBinding="gvwListagem_DataBinding" 
                                            OnSelectedIndexChanged="gvwListagem_SelectedIndexChanged" SelectedIndex="0" 
                                            SkinID="SemSelect" Style="margin-top: 0px">
                                            <Columns>
                                                <asp:TemplateField ShowHeader="False">
                                                    <ItemStyle CssClass="PaddingGridView" HorizontalAlign="Center" Width="25px" />
                                                    <HeaderStyle CssClass="PaddingGridViewHeader" />
                                                </asp:TemplateField>
                                                <asp:BoundField DataField="IdProduto" HeaderText="Código" />
                                                <asp:BoundField DataField="Descricao" HeaderText="Produto" />
                                                <asp:BoundField DataField="Unidade" HeaderText="Unidade" />
                                                <asp:BoundField DataField="Quantidade" HeaderText="Quantidade" />
                                                <asp:BoundField DataField="Preco" HeaderText="V. Unitário" />
                                                <asp:BoundField DataField="Valor" HeaderText="V. Total" />
                                            </Columns>
                                        </asp:GridView>
                                        <asp:ObjectDataSource ID="odsItemCompraItem" runat="server" 
                                            OldValuesParameterFormatString="original_{0}" 
                                            OnSelecting="odsItemCompraItem_Selecting" SelectMethod="ObterItensCompra" 
                                            TypeName="SisVenda.Web.Restrito.Fn.CompraFn">
                                            <SelectParameters>
                                                <asp:Parameter Name="idCompra" Type="Int32" />
                                            </SelectParameters>
                                        </asp:ObjectDataSource>
                                    </asp:Panel>
                                </div>
                            </div>
                            <br />
                            <div class="acoes">
                                &nbsp;
                                <asp:Button ID="btnAlterar" runat="server" CommandName="Edit" SkinID="Alterar" 
                                    Style="cursor: pointer;" Text="Alterar" />
                                &nbsp;<asp:Button ID="btnExcluirItem" runat="server" CommandName="Delete" 
                                    SkinID="Excluir" Style="cursor: pointer;" Text="Excluir" />
                                &nbsp;<asp:Button ID="btnNovoItem" runat="server" CommandName="New" SkinID="Novo" 
                                    Style="cursor: pointer;" Text="Novo" />
                                <act:ConfirmButtonExtender ID="ConfirmButtonExtenderItem" runat="server" 
                                    DisplayModalPopupID="ModalPopupExtenderItem" OnClientCancel="cancelClick" 
                                    TargetControlID="btnExcluirItem" />
                                <br />
                                <act:ModalPopupExtender ID="ModalPopupExtenderItem" runat="server" 
                                    BackgroundCssClass="modalBackground" CancelControlID="ButtonCancelItem" 
                                    Enabled="True" OkControlID="ButtonOkItem" PopupControlID="PNLItem" 
                                    TargetControlID="btnExcluirItem" />
                                <asp:Panel ID="PNLItem" runat="server" Style="display: none; width: 200px; background-color: White;
                                    border-width: 2px; border-color: Black; border-style: solid; padding: 20px; text-align: left;
                                    background: -webkit-gradient(linear, left top, left 56, from(#bfcbd6), color-stop(4%, #bfcbd6), to(#FFFFFF));
                                    background: -moz-linear-gradient(top, #bfcbd6, #bfcbd6 1px, #FFFFFF 50px); border-radius: 4px;
                                    -webkit-border-radius: 4px; -moz-border-radius: 4px;">
                                    <div style="text-align: right;">
                                        <img alt="?" src="../App_Themes/Tema/Images/help-icon.png" />
                                    </div>
                                    Deseja realmente excluir o registro?
                                    <br />
                                    <br />
                                    <div style="text-align: right;">
                                        <asp:Button ID="ButtonOkItem" runat="server" Style="cursor: pointer;" 
                                            Text="Sim" />
                                        <asp:Button ID="ButtonCancelItem" runat="server" Style="cursor: pointer;" 
                                            Text="Não" />
                                    </div>
                                </asp:Panel>
                            </div>
                        </asp:Panel>
                    </ItemTemplate>
                </asp:FormView>
                <asp:ObjectDataSource ID="odsFormViewCompra" runat="server" 
                    DeleteMethod="DeleteCompra" OldValuesParameterFormatString="original_{0}" 
                    OnDeleted="odsFormViewCompra_Deleted" OnDeleting="odsFormViewCompra_Deleting" 
                    OnInserted="odsFormViewCompra_Inserted" 
                    OnSelecting="odsFormViewCompra_Selecting" OnUpdated="odsFormViewCompra_Updated" 
                    SelectMethod="ObterCompraID" TypeName="SisVenda.Web.Restrito.Fn.CompraFn">
                    <DeleteParameters>
                        <asp:Parameter Name="idCompra" Type="Int32" />
                    </DeleteParameters>
                    <SelectParameters>
                        <asp:Parameter Name="idCompra" Type="Int32" />
                    </SelectParameters>
                </asp:ObjectDataSource>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="ddlNumeroLinhasGrid" 
                    EventName="SelectedIndexChanged" />
                <asp:AsyncPostBackTrigger ControlID="gvwListagem" 
                    EventName="SelectedIndexChanged" />
                <asp:AsyncPostBackTrigger ControlID="btnPesquisar" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
    </asp:Panel>
</asp:Content>
